//
//  DDCompanySuperinerCell.m
//  DingDongZP
//
//  Created by weily on 16/5/9.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

#import "DDCompanySuperinerCell.h"

@interface DDCompanySuperinerCell ()
<UIScrollViewDelegate>

@end

@implementation DDCompanySuperinerCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.nameLab = [[UILabel alloc]init];
        self.nameLab.textColor = COLOR_FONT_MAIN_GREEN;
        self.nameLab.text = @"高管介绍";
        self.nameLab.font = [UIFont systemFontOfSize:17];
        [self.contentView addSubview:self.nameLab];
        
        WEAKSELF
        [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf);
            make.height.equalTo(@(30));
            make.centerX.equalTo(weakSelf);
        }];
        
        UILabel *leftView = [[UILabel alloc]init];
        leftView.textColor = COLOR_FONT_LIGHT_GRAY;
        leftView.text = @"----------------";
        leftView.textAlignment = 0;
        leftView.adjustsFontSizeToFitWidth = YES;
        [self.contentView addSubview:leftView];
        [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf).offset(13);
            make.left.equalTo(@(10));
            make.height.equalTo(@(3));
            make.right.equalTo(self.nameLab.mas_left);
        }];
        
        UILabel *rightView = [[UILabel alloc]init];
        rightView.textColor = COLOR_FONT_LIGHT_GRAY;
        rightView.text = @"----------------";
        rightView.textAlignment = 2;
        rightView.adjustsFontSizeToFitWidth = YES;
        [self.contentView addSubview:rightView];
        [rightView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf).offset(13);
            make.left.equalTo(self.nameLab.mas_right);
            make.height.equalTo(@(3));
            make.right.equalTo(weakSelf).offset(-10);
        }];
        
        
        self.iconView = [[UIImageView alloc]init];
        self.iconView.userInteractionEnabled = YES;
        [self.contentView addSubview:self.iconView];
        [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(70, 70));
            make.top.equalTo(self.nameLab.mas_bottom).offset(20);
            make.centerX.equalTo(weakSelf);
            
        }];
        self.iconView.layer.cornerRadius = 35;
        self.iconView.layer.masksToBounds = YES;
        
        
        self.BossName = [[UILabel alloc]init];
        self.BossName.textColor = COLOR_FONT_BLACK;
        self.BossName.font = [UIFont systemFontOfSize:15];
        self.BossName.textAlignment = 1;
        [self.contentView addSubview:self.BossName];
        [self.BossName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.iconView.mas_bottom).offset(10);
            make.left.equalTo(@(0));
            make.right.equalTo(weakSelf);
            make.height.equalTo(@(30));
        }];
        
        self.BossJob = [[UILabel alloc]init];
        self.BossJob.textColor = COLOR_FONT_BLACK;
        self.BossJob.font = [UIFont systemFontOfSize:15];
        self.BossJob.textAlignment = 1;
        [self.contentView addSubview:self.BossJob];
        [self.BossJob mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.BossName.mas_bottom);
            make.left.equalTo(@(0));
            make.right.equalTo(weakSelf);
            make.height.equalTo(@(30));
        }];
        
        
        UILabel *positionTitle = [[UILabel alloc]init];
        positionTitle.textColor = COLOR_FONT_MAIN_GREEN;
        positionTitle.backgroundColor = [UIColor colorWithWhite:0.965 alpha:1.000];
        positionTitle.text = @"直聘职位";
        positionTitle.font = [UIFont systemFontOfSize:17];
        positionTitle.textAlignment = 1;
        [self.contentView addSubview:positionTitle];
        [positionTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.BossJob.mas_bottom).offset(10);
            make.width.equalTo(weakSelf);
            make.height.equalTo(@(50));
        }];
        
    }
    
    return self;
}

+(instancetype)loadTableView:(UITableView *)tableView
{
    NSString *simpleIdentify = @"DDCompanySuperinerCell";
    DDCompanySuperinerCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleIdentify];
    if(cell == nil)
    {
        cell = [[DDCompanySuperinerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleIdentify];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (void)setCompanyInfo:(DDCompanyInfo *)companyInfo
{
    _companyInfo = companyInfo;
    
    NSString *url = [DDAPIGenerate imageURLWithPath:companyInfo.ceo_logo];
    [self.iconView  sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"default_header"]];
    self.BossName.text = companyInfo.ceo_name;
    self.BossJob.text = companyInfo.ceo_position_customized ? companyInfo.ceo_position_customized : companyInfo.ceo_position_name;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}

@end


